--- a/config/makefiles/rust.mk
+++ b/config/makefiles/rust.mk
@@ -91,6 +91,7 @@ ifndef MOZ_LTO_RUST_CROSS
 ifndef rustflags_sancov
 # Never enable when coverage is enabled to work around https://github.com/rust-lang/rust/issues/90045.
 ifndef MOZ_CODE_COVERAGE
+ifeq (,$(findstring riscv64,$(RUST_TARGET)))
 ifeq (,$(findstring gkrust_gtest,$(RUST_LIBRARY_FILE)))
 cargo_rustc_flags += -Clto
 endif
@@ -101,6 +102,7 @@ endif
 endif
 endif
 endif
+endif
 
 ifdef CARGO_INCREMENTAL
 export CARGO_INCREMENTAL
